package dshop;

import com.jfinal.kit.PropKit;

import appbase.fileUpload.FileService;
import appbase.third.QiNiuKit;
import appbase.third.chuanglan.SnsKit;
import appbase.third.xinge.XingePushKit;
import dshop.service.RongCloudService;



public class AppConst {

	//分页参数
	public static int PAGE_NUM_DEFAULT = 1;
	public static int PAGE_SIZE_DEFAULT = 20;
	public static int PAGE_SIZE_API_DEFAULT = 20;
	
	//JSP 常用页面
	public static final String JSP_BASE_VIEW_PATH = "/WEB-INF/web";
	public static final String JSP_LOGIN = "/login.jsp";
	public static final String JSP_INDEX_ADMIN = "/admin/index.jsp";
	public static final String JSP_RESULT_SUCCESS = JSP_BASE_VIEW_PATH + "/common/result_success.jsp";
	
	//常用HTTP请求参数
	public static final String PARAM_KEY_CURRENT_URL = "currentUrl";
	
	//服务端返回参数
	public static final String RESPONSE_KEY_CODE = "status_code";
	public static final String RESPONSE_KEY_MSG = "status_msg";
	public static final String RESPONSE_ROLE = "role";
	public static final String RESPONSE_ADDRESS = "address";
	public static final String RESPONSE_REDIRECT_URL = "redirect_url";
	
	//服务端返回参数值：200 请求成功；300 请求失败，发生异常；301 会话失效；302 没有访问权限；404 内容不见了
	public static final int RESPONSE_VALUE_CODE_SUCCESS = 200;
	public static final int RESPONSE_VALUE_CODE_FAIL = 300;
	public static final int RESPONSE_VALUE_CODE_UNAUTHENTICATION = 301;
	public static final int RESPONSE_VALUE_CODE_UNAUTHORITY = 302;
	public static final int RESPONSE_VALUE_CODE_404 = 404;
	public static final String RESPONSE_VALUE_DEFAULT_MSG = "";
	
	
	//常用常量：0 未删除；1 已删除
	public static final int DELETE_NO = 0;
	public static final int DELETE_YES = 1;
	
	public static final int STATUS_VAL_YES = 1;
	public static final int STATUS_VAL_NO = 0;
	
	//图片文件夹
	public static final String FOLDER_IMAGE_COMPANY_AUTH = "company_auth";
	public static final String FOLDER_IMAGE_LOTTERY_QR = "lottery/qr";
	public static final String FOLDER_STOCK_EXPORT = "stock/export";
	
	public static final String CHECK_STATUS_NOT = "NOT";
	public static final String CHECK_STATUS_ING = "ING";
	public static final String CHECK_STATUS_PASS = "PASS";
	public static final String CHECK_STATUS_FAIL = "FAIL";
	
	public static final String DELETE_STR_NO = "NO";
	public static final String DELETE_STR_YES = "YES";
	
	
	
	
	public static String APP_DEFAULT_USER_HEAD_IMG;
	
	public static void init()
	{
		PropKit.use("config.txt");
		
		APP_DEFAULT_USER_HEAD_IMG = PropKit.get("APP_DEFAULT_USER_HEAD_IMG");
		
		//七牛云
		String qiniuAccessKey = PropKit.get("qiniu_access_key");
		String qiniuSecretKey = PropKit.get("qiniu_secret_key");
		String qiniuDomain = PropKit.get("qiniu_domain");
		String qiniuBucket = PropKit.get("qiniu_bucket");
		QiNiuKit.init(qiniuAccessKey, qiniuSecretKey, qiniuBucket, qiniuDomain);
		
		//本地文件服务
		String fileServerHostAndPort = PropKit.get("fileServerHostAndPort");
		String webAppsAbsolutePath = PropKit.get("webAppsAbsolutePath");
		String fileAppName = PropKit.get("fileAppName");
		FileService.init(fileServerHostAndPort, webAppsAbsolutePath, fileAppName);
		
		//信鸽推送
		String androidAppId = PropKit.get("xg_android_app_id");
		String androidSecretKey = PropKit.get("xg_android_secret_key");
		String iosAppId = PropKit.get("xg_ios_app_id");
		String iosSecretKey = PropKit.get("xg_ios_secret_key");
		String iosEnvironment = PropKit.get("xg_ios_environment");
		String pushTitle = PropKit.get("xg_push_title");
		XingePushKit.init(androidAppId, androidSecretKey, iosAppId, iosSecretKey, iosEnvironment, pushTitle);
		
		//创蓝短信
		String snsAccount = PropKit.get("sns_account");
		String snsPassword = PropKit.get("sns_password");
		String snsUrl = PropKit.get("sns_url");
		String snsSign = PropKit.get("sns_sign");
		SnsKit.init(snsAccount, snsPassword, snsUrl, snsSign);
		
		//融云
		String rongAppKey = PropKit.get("rong_app_key");
		String rongAppSecret = PropKit.get("rong_app_secret");
		Integer rongAppSenderId = PropKit.getInt("ronder_app_sender_id");
		RongCloudService.initRongCloud(rongAppKey, rongAppSecret, rongAppSenderId);
	}
	
}
